package com.itheima.api;

import com.itheima.domain.Student;

import java.util.Objects;
/*
使用工具类 可以避免 空指针异常
 */
public class Demo05 {

    public static void main(String[] args) {


        Student student = null;
        System.out.println(Objects.toString(student));
        //System.out.println(student.toString());

        System.out.println(student);
        System.out.println(Objects.toString(student,"来一个默认值"));

        System.out.println(Objects.isNull(student));
        System.out.println(Objects.nonNull(student));
        System.out.println(student==null);
        System.out.println(student!=null);
    }
}
